<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class BaseController extends Controller
{
    public $data = [];
    public $message = 'success';
    public $error = 0;
    protected $serve;

    public function success(): \Illuminate\Http\JsonResponse
    {
        return response()->json([
            'data' => $this->data,
            'message' => $this->message,
            'error' => $this->error,
        ]);
    }

    public function successMessage(string $message): \Illuminate\Http\JsonResponse
    {
        $this->message = $message;
        return $this->success();
    }

    public function successData($data): \Illuminate\Http\JsonResponse
    {
        $this->data = $data;
        return $this->success();
    }


}
